import React from 'react';

import FaClose from 'react-icons/lib/fa/close';

import styles from './preimg.css';
import RenderButton from "./RenderButton";
import FloatBtn from "../pic/FloatBtn";

class PreImg extends React.Component {

  componentWillUnmount() {
    this.props.cancel();
  }

  newWindowPre = () => {
    // const newwin = window.open();
    // newwin.document.write("<img src=" + this.props.src + " />")
  };


  hideBigger = () => {
    this.props.cancel();
  };

  render() {
    const {src, visible, cancel} = this.props;

    return (
      <div className={styles.pre_img_container + (visible ? ' ' + styles.pre_show : '')}>
        {/*<a title={"点击查看大图"} onClick={this.newWindowPre} style={{pointer: 'cursor'}}>*/}
          {/*<img className={styles.pre_img} alt={'渲染图'} src={src}/>*/}
        {/*</a>*/}
        {/*<button onClick={cancel} className={styles.pre_close_btn}><FaClose/></button>*/}


        <div className={styles.full_img_panel} onClick={this.hideBigger}>
          <img className={styles.full_img} src={src}/>
        </div>

      </div>
    )
  }

}

export default PreImg;
